/**
 * 文章相关路由配置
 */
const express = require('express');
const { createPostHandler, getPostsHandler, getPostByIdHandler, updatePostHandler, deletePostHandler } = require('../controllers/postsController');

const router = express.Router();

// 创建文章API端点
router.post('/', createPostHandler);

// 获取文章列表
router.get('/', getPostsHandler);

// 获取单篇文章详情
router.get('/:id', getPostByIdHandler);

// 更新文章
router.put('/:id', updatePostHandler);

// 删除文章
router.delete('/:id', deletePostHandler);

module.exports = router;